import { get, post, remove, put } from '@/utils/request'

/**
 * 用户登录
 * @param string username 用户名
 * @param string password 密码
 * @returns Promise
 * 
 * ```
 * // 示例
 * doLogin('admin','admin')
 * ``` 
 */
export const doLogin = (username, password) => {
  return post('/api/login', { username, password })
}

// 添加用户
export const addUser = userinfo => {
  return post('/api/cont', userinfo)
}

// 分页获取数据
export const getUserList = () => {
  return get('/api/cont')
}

// 删除用户
export const deleteUser = (id = 0) => {
  return remove('/api/cont/' + id)
}

// 根据id返回对的用户信息
export const getUserInfo = (id = 0) => {
  return get('/api/cont/' + id)
}

// 修改用户
export const putUserInfo = (id = 0) => {
  return put('/api/cont/' + id)
}


